package com.zlf.blog.dao.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zlf.blog.dao.pojo.Article;
import com.zlf.blog.dao.pojo.CommentVo;
import com.zlf.blog.vo.*;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
* @author zlfi1
* @description 针对表【ms_article】的数据库操作Mapper
* @createDate 2022-07-02 09:33:34
* @Entity com.mszlu.blog.dao.pojo.Article
*/
public interface ArticleMapper extends BaseMapper<Article> {

    /**
     * 查找Article
     * @return
     */
    List<Article> selectArticle();

    /**
     * 根据作者id查找article
     * @param authorId
     * @return
     */
    List<ArticleVo> selectByAuthorId(@Param("authorId") String authorId);

    /**
     * 根据articleId查找body
     * @param bodyId
     * @return
     */
    EditResultVo selectArticleBodyById(@Param("bodyId") String bodyId);

    /**
     * 更新article
     * @param editArticleVo
     * @return
     */
    int updateArticleBodyById(@Param("editArticleVo") EditArticleVo editArticleVo);

    /**
     * 添加article
     * @param articleAdd
     * @return
     */
    int addArticle(@Param("articleAdd") ArticleAdd articleAdd);

    /**
     * 文件上传
     * @param fileId
     * @param fileName
     * @param userAccount
     * @return
     */
    int uploadFile(@Param("fileId") String fileId,@Param("fileName") String fileName,@Param("userAccount") String userAccount);

    /**
     * 删除article
     * @param articleId
     * @return
     */
    int deleteArticle(@Param("articleId") String articleId);

    /**
     * 查找tag
     * @param articleId
     * @return
     */
    List<TagVo> selectTag(@Param("articleId") String articleId);

    /**
     * 查看详情
     * @param articleId
     * @return
     */
    ArticleBody viewArticle(@Param("articleId") String articleId);

    /**
     * 查找tagId
     * @param tagName
     * @return
     */
    String selectTagId(@Param("tagName") String tagName);

    /**
     * 根据bodyId查找tagId
     * @param articleId
     * @return
     */
    String tagIdByArticleId(@Param("articleId") String articleId);

    /**
     * 根据bodyId查找articleId
     * @param bodyId
     * @return
     */
    String articleIdByBodyId(@Param("bodyId") String bodyId);

    /**
     * 添加articleTagInfo
     * @param articleId
     * @param tagId
     * @return
     */
    int addArticleTag(@Param("articleId") String articleId,@Param("tagId") String tagId);




}
